//!@Author: DengLibin
//!@Date: Create in 2025-05-08 11:55:03
//!@Description:

use my_trait::MustHaveTableName;
use sqlx::{MySql, Pool};

use crate::{
    entity::dictionary_info::DictionaryInfo,
    sys::global:: GlobalResult,
};


///@Author: DengLibin
///@Date: Create in 2025-05-08 11:56:43
///@Description: 查询所有
pub async fn get_all(pool: &Pool<MySql>) -> GlobalResult<Vec<DictionaryInfo>> {
    let sql: String = format!("SELECT id,name, parent_id, tree_num FROM {} order by id", DictionaryInfo::table_name());
    let result = sqlx::query_as::<MySql, DictionaryInfo>(&sql).fetch_all(pool).await?;
    Result::Ok(result)
}
